﻿using System;
using Microsoft.AspNetCore.Mvc;
using System.Xml.Linq;
using VegetableSale.NET.Entities;
using VegetableSale.NET.Services;

namespace VegetableSale.NET.Controllers;

[ApiController]
[Route("api/[Action]")]
public class ProviderController : Controller
{
    private ProviderService providerService = new ProviderService();

    [HttpPost(Name = "providerlist")]
    public Result providerlist([FromBody] QueryDTO queryDTO)
    {
        return providerService.getProviderList(queryDTO);
    }

    [HttpPost(Name = "provideradd")]
    public Result provideradd([FromBody] Provider provider)
    {
        return providerService.addProvider(provider);
    }

    [HttpPost(Name = "providerdelete")]
    public Result providerdelete(int id)
    {
        return providerService.deleteProvider(id);
    }

    [HttpPost(Name = "providerupdate")]
    public Result providerupdate([FromBody] Provider provider)
    {
        return providerService.updateProvider(provider);
    }

    [HttpPost(Name = "providerAllProvider")]
    public Result providerAllProvider()
    {
        return providerService.allProvider();
    }
}